<?php

namespace App\Http\Controllers;

use App\CategoryDesc;
use App\model\Post;
use Illuminate\Http\Request;

class IndexController extends Controller
{
    public function  index(){
        return view('mobile.index');
    }
    public function hexin(){
        return view('mobile.hexin');
    }
    public function youshi(){
        return view('mobile.youshi');
    }
    public function about(){
        return view('mobile.about');
    }
    public function jingdian(){
        return view('mobile.jingdian');
    }
    public function news(){
        $post= Post::where('is_display',0)
            ->orderBy('sort','desc')
            ->get()
        ;
        return view('mobile.news',compact('post'));
    }
    public function zhaopin(){
        return view('mobile.zhaopin');
    }
    public function newsDetail($id){

        $post=Post::find($id);
        return view('mobile.newsDetail',compact('post'));
    }
    public function contact(){
        return view('mobile.contact');
    }
    public function jieshao(){
        return view('mobile.jieshao');
    }
    public function wechat(Request  $request){
        $offical=\EasyWeChat::officialAccount();
         return  $offical->jssdk->buildConfig(['updateAppMessageShareData','onMenuShareAppMessage','onMenuShareTimeline'], $debug = false, $beta = false, $json = true,[],$request->link);
    }
    public function singlepage(Request  $request,$category,$user_id){
           $categoryDesc= CategoryDesc::find($user_id);
           return view('mobile.singlepage',compact('categoryDesc'));
    }
}
